grammar SocialNetwork;

@parser::header {
	package org.amicofragile.antlrsamples.loader.parser;
	
	import org.amicofragile.antlrsamples.loader.SocialNetworkParserHelper;
}

@lexer::header {
	package org.amicofragile.antlrsamples.loader.parser;
}

@members {
	private SocialNetworkParserHelper helper;
	
	public SocialNetworkParser(TokenStream input, SocialNetworkParserHelper helper) {
		this(input);
		this.helper = helper;
	}
}


script : friendship * EOF ;
friendship : left = Name 'is' 'friend' 'of' right = Name {helper.registerFriendship($left.getText(), $right.getText());} ;

Name : ('a'..'z' | 'A'..'Z')+ ;
WS : (' ' |'\t' | '\r' | '\n')+ {skip();} ;
COMMENT : '#'(~'\n')* {skip();} ;
ILLEGAL : .;